﻿using Microsoft.AspNetCore.Mvc;
using mozhi.smarterp.Finance.Querys;
using System;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;

namespace mozhi.smarterp.Finance.Basedatas
{
    [RemoteService]
    [Route("api/v1/printtemplates")]
    public class PrintTemplateController :BaseController
    {
        private IPrintTemplateAppService _appService;
        
        public PrintTemplateController(IPrintTemplateAppService appService)
        {
            _appService = appService;
        }

        

        [HttpGet]
        public async Task<PagedResultDto<PrintTemplateDto>> GetAsync(PrintTemplatePageQuery query)
        {
            return await _appService.FindAsync(query);
        }

        [HttpGet]
        [Route("{id}")]
        public async Task<PrintTemplateDto> GetAsync(Guid id)
        {
            var result = await _appService.GetAsync(id);

            return result;
        }

        [HttpPost]
        public async Task<PrintTemplateDto> CreateAsync(PrintTemplateCreateDto dto)
        {
            var result = await _appService.CreateAsync(dto);

            return result;
        }

        [HttpPut]
        public async Task<PrintTemplateDto> UpdateAsync(PrintTemplateUpdateDto dto)
        {
            var result = await _appService.UpdateAsync(dto);

            return result;
        }



        [HttpDelete]
        [Route("{id}")]
        public async Task DeleteAsync(Guid id)
        {
            await _appService.DeleteAsync(id);
        }

       
    }
}
